package com.supervision.manage.service

import com.fly.base.misc.pagination.Pagination
import com.supervision.domain.bean.po.SmsPO
import com.supervision.domain.model.SmsTemplate
import com.supervision.manage.mapper.SmsTemplateMapper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

@Service("SmsTemplateService")
class SmsTemplateService {

    companion object {
        private val logger = org.slf4j.LoggerFactory.getLogger(SmsTemplateService::class.java)
    }

    @Autowired
    lateinit var smsTemplateMapper: SmsTemplateMapper

    fun select(condition: SmsTemplate, otherCondition: String?): List<SmsTemplate> {
        return smsTemplateMapper.select(condition, otherCondition)
    }

    fun getSmsTemplateList(po: SmsPO): HashMap<String, Any> {
        val list = smsTemplateMapper.getSmsTemplateList(po, Pagination.limitSql(po.page, po.pageSize))
        val count = smsTemplateMapper.countSmsTemplateList(po, "")

        return hashMapOf<String, Any>(
                "list" to list,
                "count" to count
        )
    }
}
